/**
 * licenses
 *
 */
package com.openjawtech.xscraper.flights.dao.impl;

import org.hibernate.Transaction;
/**
 * <p>a aspect for the dao transaction control
 *
 * <p>16/02/2009
 * created with AJDT (aspectj 1.6.2)
 * @author Wenbo.Sun
 */
public aspect TrasactionControl {
	

    //all the methods in DAOImpl
	pointcut transaction() : execution(* *DAOImpl.*(..));

    //trasaction start
	before() : transaction()
{
		Transaction tc = HibernateSessionFactory.getSession().beginTransaction();
		tc.begin();
	}

    //trasaction commit
	after() returning : transaction()
{		Transaction tc = HibernateSessionFactory.getSession().beginTransaction();
		tc.commit();
	}

    //trasaction rollback
	after() throwing : transaction()
{		Transaction tc = HibernateSessionFactory.getSession().beginTransaction();
		tc.rollback();
	}

}
